package top.chengdongqing.mishop.order.review.vo

import top.chengdongqing.mishop.entities.Order
import top.chengdongqing.mishop.order.vo.OrderItemVO
import java.io.Serializable
import java.math.BigDecimal
import java.time.LocalDateTime

data class PendingReviewOrderVO(
    val orderId: Int,
    val orderNumber: String,
    val orderAt: LocalDateTime,
    val paidAmount: BigDecimal,
    val items: List<OrderItemVO>
) : Serializable {
    companion object {
        fun of(order: Order): PendingReviewOrderVO {
            return PendingReviewOrderVO(
                orderId = order.id,
                orderNumber = order.orderNumber,
                orderAt = order.createdAt!!,
                paidAmount = order.paidAmount,
                items = OrderItemVO.of(order.items)
            )
        }
    }
}
